package com.qing.demo.netty.demo1.bio.client;

import com.qing.demo.netty.demo1.bio.ChannelAdapter;
import com.qing.demo.netty.demo1.bio.ChannelHandler;

import java.net.Socket;
import java.nio.charset.Charset;

/**
 * @author caozhipeng
 * @date 2025/7/22
 */
public class BioClientHandler extends ChannelAdapter {
    public BioClientHandler(Socket socket, Charset charset) {
        super(socket, charset);
    }

    @Override
    public void channelRead(ChannelHandler channelHandler, String str) {
        System.out.println("客户端接收信息："+str+" \r\n");
        channelHandler.writeAndFlush("我已经收到你的信息了");
    }

    @Override
    public void channelActive(ChannelHandler channelHandler) {
        channelHandler.writeAndFlush("我是客户端，我已经链接上服务端了\r\n");
    }
}
